<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="/TallerMecanico/common/css/estilo.css" />
<title></title>
<script src="/TallerMecanico/common/jquery/jquery-1.10.2.js"></script>
<script src="/TallerMecanico/common/js/jquery.Rut.js"></script>
<script src="/TallerMecanico/common/js/jquery.validate.js"></script>
<script type="text/javascript">
	function validar() {
		document.getElementById("formulario").action = "ingresarOrden.do";
		document.getElementById("formulario").submit();
	}
	$(document).ready(function(){
	$('#rut_consultar').Rut({
		  digito_verificador: '#dv_consultar',
		  on_error: function(){ alert('Rut incorrecto'); }
		});
	
	
	$("#formulario").validate({
		rules : {
			rut_consultar : {required : true,minlength : 8, maxlength : 10},
			dv_consultar : {required : true,digits : true,minlength : 1, maxlength : 1},
		},
		messages : {
			rut_consultar : "Debe Intruducir rut.",
			dv_consultar : "Debe Intruducir digito verificador.",
		},
		submitHandler : function(form) {
			document.getElementById("formulario").action = "ingresarOrden.do";
			document.getElementById("formulario").submit();
		}
	});
	
	});
</script>
</head>
<body>
	<h1>Ingresar Orden de Trabajo</h1>
	<h2>Consultar Cliente</h2>
	<form name="formulario" id="formulario" method="post">
		<input type="hidden" id="metodo" name="metodo" value="consultarCliente">
		<input type="text" id="rut_consultar" name="rut_consultar" /> 
		<input type="text" id="dv_consultar" name="dv_consultar" maxlength="1" size="1" /> 
		<input type="submit" value="Consultar Cliente" />
	</form>
</body>
</html>